<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>营销策划新增</title>
</head>
<style>
	.fieldset{
		margin-top: 5px;
		margin-bottom: 0px
	}
	.layui-legend{
		background-color:#5fb878;
		font-size:15px !important;
		width:140px;
	}
	.layui-form-item {
	    margin-bottom: 5px;
	    clear: both;
	    *zoom: 1;
	}
	.layui-form-label{width: 180px;}
	.right{
		float:right;
	}
	.width106{
		width:106px;
	}
	.width98{
		width:98px;
	}
	.width60{
		width:60px;
	}
</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
	    <div class="layui-tab-item layui-show">
	    	<div style="padding-top:15px;">&nbsp;</div>
			<form class="layui-form" id="addInfo_form" lay-filter="add_info_from">
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="baseInfo">
				  <legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目基础信息  ></legend>
				  <div style="margin-top:20px">
				  	<div class="layui-form-item">
				  		<div class="layui-inline">
					      	<label class="layui-form-label">项目名称</label>
					      	<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="id" value="${proSell.id}">
								<input type="text" name="proName" value="${proSell.proName}" style="border:0px;"  readonly maxlength="100" lay-verify="required" autocomplete="off" class="layui-input">
							</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">项目类型</label>
							<div class="layui-input-inline" style="width: 250px">
								<select name="types" disabled>
									<option value="1" <c:if test="${proSell.types=='1'}">selected="selected"</c:if>>PPP项目</option>
									<option value="2"  <c:if test="${proSell.types=='2'}">selected="selected"</c:if>>EPC项目</option>
								</select>
							</div>
					    </div>

				    </div>
				  	<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">项目编号</label>
							<div class="layui-input-inline" style="width: 250px">
								<input type="text" name="proCode"  value="${proSell.proCode}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>

						<div class="layui-inline">
							<label class="layui-form-label">策划书编号</label>
							<div class="layui-input-inline" style="width: 250px">
								<input type="text" name="codes"  value="${proSell.codes}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>

				    </div>
				  	<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">申请公司</label>
							<%--<div class="layui-input-inline">
                                <input type="hidden" name="proSellOrgId" value="${bindOrgId}">
                              <input type="text" value="${bindOrgName}" style="border:0px;width:220px" readonly="readonly" class="layui-input">
                            </div>--%>
							<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrOrgId" value="${proSell.hrOrgId!=null?proSell.hrOrgId:bindOrgId}">
								<input type="text" value="${proSell.orgName!=null?proSell.orgName:bindOrgName}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">申请部门</label>
							<div class="layui-input-inline">
								<input type="hidden" name="proSellDeptId" value="${bindDeptId}">
								<input type="text" value="${bindDeptName}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>

				    </div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">项目城市</label>
							<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="sgCityId" value="${proSell.sgCityId}" >
								<input name="sgCityName" value="${proSell.sgCityName}" style="border:0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">申请人</label>
							<%--<div class="layui-input-inline">
								<input type="hidden" name="proSellHrStaffApplyId" readonly="readonly" value="${SESSION_KEY_USER_DETAIL.hrStaffId }">
								<input type="text" name="proSellStaffName" value="${SESSION_KEY_USER_DETAIL.realName }" readonly="readonly" style="border:0px" class="layui-input">
							</div>--%>
							<div class="layui-input-inline" style="width: 250px">
								<input type="hidden" name="hrStaffApplyId" value="${proSell.hrStaffApplyId!=null?proSell.hrStaffApplyId:SESSION_KEY_USER_DETAIL.hrStaffId }">
								<input type="text" name="staffName" value="${proSell.staffName!=null?proSell.staffName:SESSION_KEY_USER_DETAIL.realName }" readonly="readonly" style="border:0px" autocomplete="off" class="layui-input">
							</div>
						</div>
					</div>
					  <div class="layui-form-item">
						  <div class="layui-inline">
							  <label class="layui-form-label">营销经理</label>
							  <%--<div class="layui-input-inline">
                                <input type="hidden" name="hrStaffMktId">
                                <input type="text" name="hrStaffName" readonly="readonly" style="border:0px" class="layui-input">
                              </div>--%>
							  <div class="layui-input-inline" style="width: 250px">
								  <input type="hidden" name="hrStaffMktId" value="${proSell.hrStaffMktId}">
								  <input type="text" name="hrStaffName" value="${proSell.hrStaffName}"  readonly="readonly" style="border:0px" class="layui-input">
							  </div>
						  </div>
						  <div class="layui-inline">
							  <label class="layui-form-label">入库情况</label>
							  <div class="layui-input-inline" style="width: 250px">
								  <select name="isInStore" disabled >
									  <option value="">请选择-入库情况</option>
									  <option value="0" <c:if test="${proSell.isInStore=='0'}"> selected="selected"</c:if> >未入库</option>
									  <option value="1" <c:if test="${proSell.isInStore=='1'}"> selected="selected"</c:if> >已入库</option>
								  </select>
							  </div>
						  </div>
					  </div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">一般公共预算收入（亿元）</label>
							<div class="layui-input-inline"  style="width: 250px">
								<input type="text" name="pubIncome" value="${proSell.pubIncome}" readonly="readonly" style="border:0px" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">年度PPP项目占一般公共预算支出比例比(%)</label>
							<div class="layui-input-inline"  style="width: 250px">
								<input type="text" name="pppPercent" value="${proSell.pppPercent}"  readonly="readonly" style="border:0px" class="layui-input">
							</div>
						</div>
					</div>



				  	<div class="layui-form-item">
				  		<div class="layui-inline">
					      	<label class="layui-form-label">项目简介</label>
					      	<div class="layui-input-inline">
					        	<textarea name="proRemarks"  readonly="readonly" maxlength="500" class="layui-textarea" style="width:899px;height:90px;"></textarea>
					      	</div>
			    		</div>
		    		</div>
		  		</div>
			</fieldset>
			<fieldset class="layui-elem-field layui-field-title fieldset"  id="careerInfo">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目合作方  ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
					    <div class="layui-inline">
					    	<label class="layui-form-label">项目渠道</label>
				      		<div class="layui-input-inline">
								<select name="fromChannel"  lay-filter="add_selectFromChannel"  disabled>
									<option value="">请选择-项目渠道</option>
									<option value="1" <c:if test="${proSell.fromChannel=='1'}"> selected="selected"</c:if>>自行获取</option>
									<option value="2" <c:if test="${proSell.fromChannel=='2'}"> selected="selected"</c:if>>居间合作</option>
								</select>
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">实施机构</label>
				      		<div class="layui-input-inline">
								<input type="text" name="carryOrg" value="${proSell.carryOrg}"  style="border:0px;width:220px"  maxlength="100"  autocomplete="off" class="layui-input">
							</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">招标代理机构</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="bidAgent" value="${proSell.bidAgent}" readonly="readonly" style="border:0px;width:220px" class="layui-input">
				      		</div>
					    </div>
				    </div>
				    <div class="layui-form-item">
				    	<div class="layui-inline">
					    	<label class="layui-form-label">预计居间人费用（万元）</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="linkPowerCost" value="${proSell.linkPowerCost}" readonly="readonly" style="border:0px" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">占建安费用比例（%）</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="ofCaePercent"  value="${proSell.ofCaePercent}" readonly="readonly" style="border:0px" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline" id="linkPowerDiv" style="display:none">
					    	<label class="layui-form-label">居间方</label>
				      		<div class="layui-input-inline">
					      		<input type="text" name="linkPower" value="${proSell.linkPower}" readonly="readonly" style="border:0px;width:220px" class="layui-input">
				      		</div>
					    </div>
				    </div>
			  	</div>
			  	<fieldset class="layui-elem-field layui-field-title fieldset"  >
			  		<legend style="margin-left:40px;font-size:15px;font-weight:bold;">联合体单位  ></legend>
				  	<div style="margin-top:20px" id="coopDiv">
						<c:forEach items="${proSell.proSellCoopVos }" var="coopVo" varStatus="status">
							<div class="layui-form-item" id="linkRow${status.index+1}">
								<div class="layui-inline width106">
									<p class="right">单位<label>${status.index+1}</label>：</p>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">单位名称</label>
									<div class="layui-input-inline" <c:if test="${status.first}"> </c:if> >
										<select name="sgCoopId" disabled lay-search>
											<option value="">请选择-单位名称</option>
											<c:if test="${not empty coopInfos }">
												<c:forEach items="${coopInfos}" var="coop">
													<option value="${coop.id }" <c:if test="${coopVo.sgCoopId==coop.id}"> selected="selected"</c:if>>${coop.coopName }</option>
												</c:forEach>
											</c:if>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">单位作用</label>
									<div class="layui-input-inline" <c:if test="${status.first}">id="coopEffectSelect"</c:if> >
										<select name="coopEffect" disabled>
											<option value="">请选择-单位作用</option>
											<option value="1" <c:if test="${coopVo.coopEffect=='1'}"> selected="selected"</c:if>>关系维护</option>
											<option value="2" <c:if test="${coopVo.coopEffect=='2'}"> selected="selected"</c:if>>资质补充</option>
											<option value="3" <c:if test="${coopVo.coopEffect=='3'}"> selected="selected"</c:if>>资金投入</option>
											<option value="4" <c:if test="${coopVo.coopEffect=='4'}"> selected="selected"</c:if>>运营合作</option>
										</select>
									</div>
								</div>
								<%--<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn${status.index+1}" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
									<c:if test="${not status.first}">
										<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn4" onclick="deleteRow(${status.index+1});"><i class="layui-icon">&#xe640;</i></button>
									</c:if>
								</div>--%>
							</div>
						</c:forEach>
						<c:if test="${empty proSell.proSellCoopVos }">
							<div class="layui-form-item" >
								<div class="layui-inline width106">
									<p class="right">单位<label>1</label>：</p>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">单位名称</label>
									<div class="layui-input-inline" >
										<select name="sgCoopId" disabled lay-search>
											<option value="">请选择-单位名称</option>
											<c:if test="${not empty coopInfos }">
												<c:forEach items="${coopInfos}" var="coop">
													<option value="${coop.id }">${coop.coopName }</option>
												</c:forEach>
											</c:if>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">单位作用</label>
									<div class="layui-input-inline" >
										<select name="coopEffect" disabled>
											<option value="">请选择-单位作用</option>
											<option value="1">关系维护</option>
											<option value="2">资质补充</option>
											<option value="3">资金投入</option>
											<option value="4">运营合作</option>
										</select>
									</div>
								</div>
								<%--<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn1" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
								</div>--%>
							</div>
						</c:if>
					</div>
			  	</fieldset>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset" id="loanInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目子项  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">合作周期（年）</label>
					      		<div class="layui-input-inline">
						      		<input type="text" name="workYears" value="${proSell.workYears}" value="0" readonly="readonly" style="border:0px" class="layui-input">
					      		</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">建设周期（年）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="buildYears" value="${proSell.buildYears}" value="0" readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">运营周期（年）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="omYears"  value="${proSell.omYears}" value="0" readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
					    </div>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="customerFile">
					  		<legend style="margin-left:40px;font-size:15px;font-weight:bold;">项目子项  ></legend>
						  	<div style="margin-top:20px" id="subDiv">
								<c:forEach items="${proSell.proSellSubs}" var="subs" varStatus="status">
									<div id="commRow${status.index+1}">
										<div class="layui-form-item">
											<div class="layui-inline width106">
												<p class="right">子项<label>${status.index+1}</label>：</p>
												<input type="hidden" name="orderIdx" value="${status.index+1}"/>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width60">子项名称</label>
												<div class="layui-input-inline" style="width:120px;">
													<input type="text" name="subName" value="${subs.subName}" readonly maxlength="100"  autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">合作周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subWorkYears" value="${subs.workYears}" readonly maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">建设周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subBuildYears" value="${subs.buildYears}" readonly maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">运营周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subOmYears" value="${subs.omYears}" readonly maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<%--<div class="layui-inline">
												<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn${status.index+1}" onclick="addCommRow(this)"><i class="layui-icon">&#xe654;</i></button>
												<c:if test="${not status.first}">
													<button type="button" class="layui-btn layui-btn-sm" id="delCommBtn${status.index+1}" onclick="deleteCommRow(${status.index+1})"><i class="layui-icon">&#xe640;</i></button>
												</c:if>
											</div>--%>
										</div>
									</div>
								</c:forEach>
								<c:if test="${empty proSell.proSellSubs}">
									<div id="commRow1">
										<div class="layui-form-item">
											<div class="layui-inline width106">
												<p class="right">子项<label>1</label>：</p>
												<input type="hidden" name="orderIdx" value="1"/>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width60">子项名称</label>
												<div class="layui-input-inline" style="width:120px;">
													<input type="text" name="subName" value="" maxlength="100"  autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">合作周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subWorkYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">建设周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subBuildYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<div class="layui-inline">
												<label class="layui-form-label width98">运营周期（年）</label>
												<div class="layui-input-inline" style="width:98px;">
													<input type="text" name="subOmYears" value="" maxlength="5" onblur="checkMaxValue(this);" lay-verify="number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<%--<div class="layui-inline">
												<button type="button" class="layui-btn layui-btn-sm" id="addCommBtn1" onclick="addCommRow(this)"><i class="layui-icon">&#xe654;</i></button>
												<button type="button" class="layui-btn layui-btn-sm" style="display:none" id="delCommBtn1" onclick="deleteCommRow(1)"><i class="layui-icon">&#xe640;</i></button>
											</div>--%>
										</div>
									</div>
								</c:if>
						  	</div>
						</fieldset>
					</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset" id="houseInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目资金信息  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">资本金数额（万元）</label>
					      		<div class="layui-input-inline">
						      		<input type="text" name="capitalFund" value="${proSell.capitalFund}"  readonly="readonly" style="border:0px" class="layui-input">
					      		</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">资本金比例（%）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="capitalPercent" value="${proSell.capitalPercent}"  readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">我方股权出资金额（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="stockFund" value="${proSell.stockFund}" readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
					    </div>
					    <div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">我方股权比例（%）</label>
					      		<div class="layui-input-inline">
						      		<input type="text" name="stockPercent" value="${proSell.stockPercent}" readonly="readonly" style="border:0px" class="layui-input">
					      		</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">总投资额（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="sumAmount" value="${proSell.sumAmount}" readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
						    <div class="layui-inline">
						      	<label class="layui-form-label">建安工程总费用（万元）</label>
						      	<div class="layui-input-inline">
						        	<input type="text" name="sumCae" value="${proSell.sumCae}" readonly="readonly" style="border:0px" class="layui-input">
						      	</div>
						    </div>
					    </div>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  				<legend style="margin-left:40px;font-size:15px;font-weight:bold;">投资构成  ></legend>
				  			<div style="margin-top:20px">
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建安工程费（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="costCae" value="${proSell.costCae}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">设备购置工程费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="deviceCost" value="${proSell.deviceCost}" readonly="readonly" style="border:0px" class="layui-input">
								      	</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">预备费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="inReadyCost" value="${proSell.inReadyCost}" readonly="readonly" style="border:0px" class="layui-input">
								      	</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建设期利息（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="periodInterest" value="${proSell.periodInterest}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">铺底流动资金（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="fluidCapital" value="${proSell.fluidCapital}" readonly="readonly" style="border:0px" class="layui-input">
								      	</div>
								    </div>
								    <div class="layui-inline">
								      	<label class="layui-form-label">工程建设其他费（万元）</label>
								      	<div class="layui-input-inline">
								        	<input type="text" name="otherCost" value="${proSell.otherCost}" readonly="readonly" style="border:0px" class="layui-input">
								      	</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">其中：征地拆迁费（万元）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="moveOutCost" value="${proSell.moveOutCost}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  			</div>
				  		</fieldset>
					    <fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  				<legend style="margin-left:40px;font-size:15px;font-weight:bold;">回报机制 ></legend>
				  			<div style="margin-top:20px">
							    <div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">回报机制 &nbsp;&nbsp;</label>
								      	<input type="hidden" name="backMech">
							      		<div class="layui-input-inline">
								      		<input type="checkbox" name="backMechName" value="1" <c:if test="${fn:contains(proSell.backMech, '1')}"> checked="checked"</c:if>  disabled title="政府付费" lay-skin="primary">
							      		</div>
							      		<div class="layui-input-inline">
											<input type="checkbox" name="backMechName" value="2" <c:if test="${fn:contains(proSell.backMech, '2')}">checked="checked"</c:if> disabled title="可行性缺口补助" lay-skin="primary">
							      		</div>
							      		<div class="layui-input-inline">
											<input type="checkbox" name="backMechName" value="3" <c:if test="${fn:contains(proSell.backMech, '3')}">checked="checked"</c:if> disabled title="使用者付费" lay-skin="primary">
							      		</div>
								    </div>
							    </div>
								<label class="layui-form-label">回报指标 ></label>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">工程费用下浮率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="downRate" value="${proSell.downRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">折现率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="discountRate" value="${proSell.downRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">合理利润率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="profitRate" value="${proSell.profitRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">建设期融资利率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="finRate"  value="${proSell.finRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">资本金回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="capitalBackRate" value="${proSell.capitalBackRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
								    <div class="layui-inline">
								    	<label class="layui-form-label">融资回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="finBackRate" value="${proSell.finBackRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  				<div class="layui-form-item">
								    <div class="layui-inline">
								    	<label class="layui-form-label">投资回报率（%）</label>
							      		<div class="layui-input-inline">
								      		<input type="text" name="investBackRate" value="${proSell.investBackRate}" readonly="readonly" style="border:0px" class="layui-input">
							      		</div>
								    </div>
							    </div>
				  			</div>
				  		</fieldset>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">业主分析  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">业主单位名称</label>
					      		<div class="layui-input-inline">
						      		<textarea name="ownerOrgName" maxlength="50" placeholder="请输入业主单位名称" lay-verify="required" class="layui-textarea" style="width:899px;min-height:50px;">${proSell.ownerOrgName}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">单位性质</label>
					      		<div class="layui-input-inline">
						      		<textarea name="orgNature" maxlength="50" placeholder="请输入单位性质" lay-verify="required" class="layui-textarea" style="width:899px;min-height:50px;">${proSell.orgNature}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">内部关系</label>
					      		<div class="layui-input-inline">
						      		<textarea name="innerRelationship" maxlength="50" placeholder="请输入内部关系" lay-verify="required" class="layui-textarea" style="width:899px;min-height:50px;">${proSell.innerRelationship}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">组织机构</label>
					      		<div class="layui-input-inline">
						      		<textarea name="orgMech" maxlength="20" placeholder="请输入组织机构" lay-verify="required" class="layui-textarea" style="width:899px;min-height:50px;">${proSell.orgMech}</textarea>
					      		</div>
						    </div>
					    </div>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">竞争分析  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">竞争对手分析情况</label>
					      		<div class="layui-input-inline">
						      		<textarea name="opponentExplain" maxlength="500" placeholder="请输入竞争对手分析情况" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.opponentExplain}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">自身竞争优势</label>
					      		<div class="layui-input-inline">
						      		<textarea name="selfGoodness" maxlength="500" placeholder="请输入自身竞争优势" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.selfGoodness}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">自身竞争劣势</label>
					      		<div class="layui-input-inline">
						      		<textarea name="selfRisk" maxlength="500" placeholder="请输入自身竞争劣势" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.selfRisk}</textarea>
					      		</div>
						    </div>
					    </div>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">营销策划  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">项目所处阶段</label>
					      		<div class="layui-input-inline">
						      		<textarea name="proStage" maxlength="500" placeholder="请输入项目所处阶段" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.proStage}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">政府关系、招标代理、咨询公司等关系推进</label>
					      		<div class="layui-input-inline">
						      		<textarea name="pushOver" maxlength="500" placeholder="请输入政府关系、招标代理、咨询公司等关系推进" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.pushOver}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">工作重点与难点</label>
					      		<div class="layui-input-inline">
						      		<textarea name="keyPoints" maxlength="500" placeholder="请输入工作重点与难点" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.keyPoints}</textarea>
					      		</div>
						    </div>
					    </div>
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">需总部支持的方面</label>
					      		<div class="layui-input-inline">
						      		<textarea name="needSupport" maxlength="500" placeholder="请输入需总部支持的方面" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.needSupport}</textarea>
					      		</div>
						    </div>
					    </div>
				  	</div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">预计营销费用 ></legend>
				  	<div style="margin-top:20px">
						<c:set var="sumcost">0</c:set>
						<c:forEach items="${proSell.proSellCosts }" var="costs" varStatus="status">
							<div class="layui-form-item" id="linkRow${status.index+1}">
								<div class="layui-inline width106">
									<p class="right">营销费用<label>1</label>：</p>
									<input type="hidden" name="costOrderIdx" value="1"/>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">费用类型</label>
									<div class="layui-input-inline" id="sgCoopSelect" style="width:130px">
										<infopub:select entireName="-" value="${costs.types}" id="query-form-companyType" layVerify="required" name="costTypes" type="dic" groupNo="A00010062"></infopub:select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width98">预计发生日期</label>
									<div class="layui-input-inline" style="width:100px">
										<input type="text"  value="<fmt:formatDate value="${costs.willOccurDate}" type="date" pattern="yyyy-MM-dd"/>" class="layui-input sub-date" name="willOccurDate" id="willOccurDate" autocomplete="off" lay-verify="required" readonly>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width98">费用金额（元）</label>
									<div class="layui-input-inline" style="width:100px">
										<input type="text" class="layui-input" maxlength="13" name="costMoney" value="${costs.costMoney}" onblur="isNumberFloat(this);arabiaToCN(this,1);" lay-verify="required|floatAmount">
									</div>
								</div>
								<c:set var="sumcost">${sumcost+costs.costMoney}</c:set>
								<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn${status.index+1}" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
									<c:if test="${not status.first}">
										<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn${status.index+1}" onclick="deleteRow(${status.index+1});"><i class="layui-icon">&#xe640;</i></button>
									</c:if>
								</div>
							</div>
						</c:forEach>

						<c:if test="${empty proSell.proSellCosts }">
							<div class="layui-form-item" id="linkRow1">
								<div class="layui-inline width106">
									<p class="right">营销费用<label>${status.index+1}</label>：</p>
									<input type="hidden" name="costOrderIdx" value="1"/>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width60">费用类型</label>
									<div class="layui-input-inline" id="sgCoopSelect" style="width:130px">
										<infopub:select entireName="-" id="query-form-companyType" layVerify="required" name="costTypes" type="dic" groupNo="A00010062"></infopub:select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width98">预计发生日期</label>
									<div class="layui-input-inline" style="width:100px">
										<input type="text" class="layui-input sub-date" name="willOccurDate" id="willOccurDate" autocomplete="off" lay-verify="required" readonly>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label width98">费用金额（元）</label>
									<div class="layui-input-inline" style="width:100px">
										<input type="text" class="layui-input" maxlength="13" name="costMoney" onblur="isNumberFloat(this);arabiaToCN(this,1);" lay-verify="required|floatAmount">
									</div>
								</div>
								<div class="layui-inline">
									<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn1" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>
								</div>
							</div>
						</c:if>


				  	</div>
				  	<div class="layui-form-item">
			  			<div class="layui-inline">
					    	<label class="layui-form-label">营销费用总计：</label>
					    	<div class="layui-input-inline">
					    		<input type="text" id="costMoneyTotal"  readonly="readonly" value="${sumcost}" style="border:0px" class="layui-input">
				      		</div>
					    </div>
				    </div>
				</fieldset>
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="creditInfo">
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">其他信息  ></legend>
				  	<div style="margin-top:20px">
				  		<div class="layui-form-item">
						    <div class="layui-inline">
						    	<label class="layui-form-label">下一阶段工作计划</label>
					      		<div class="layui-input-inline">
						      		<textarea name="nextPlan" maxlength="500" placeholder="请输入下一阶段工作计划" lay-verify="required" class="layui-textarea" style="width:899px;height:90px;">${proSell.nextPlan}</textarea>
					      		</div>
						    </div>
					    </div>
				  	</div>
				</fieldset>
				<div class="layui-form-item" style="position: fixed ! important; right: 30px; top:4%;z-index:10000;">
					<div class="layui-input-block">
			      		<%--<button class="layui-btn layui-bg-blue layui-btn-normal layui-btn-lg  layui-btn-radius" type="button" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit">
			      		<i class="layui-icon layui-icon-ok layuiadmin-button-btn"></i>
			      		提交
			      		</button>--%>
							<input type="hidden" name="submitType" id="submitType">
							<button type="button" type="button" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit2">保存</button>
							<c:if test="${edit=='edit'}">
								<button type="button" type="button" class="layui-btn layui-btn-radius" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit">提交</button>
							</c:if>
			      	</div>
			    </div>
			</form>
  		</div>
	</div>
</div>
  <script>
	//静态资源路径前缀
	var staticPath = '${fileHttpPre}';
	var stateJSON = <infopub:dicJson groupNo="A00010028" />;

  layui.config({
    base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set', 'upload', 'element', 'laydate'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element
    ,laydate = layui.laydate
    ,upload = layui.upload;

 	// 正则校验
	form.verify({
		//验证汉字
	    CHS:[
	    	/^[\u0391-\uFFE5]+$/
	    	,'只能输入汉字'
	  	],
	  	//大于0的正整数
	  	intNumber:[
			/^[1-9]\d*$/
			,'请输入正确的数字'
	  	],
	  	//数字只能有两位小数
	  	floatNumber:[
			/^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			,'请输入正确的数字'
	  	],
	  	//数字大于等于0，并只能有两位小数
	  	floatAmount:[
			/^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			//var pattern=/^((\d+\.\d*[1-9]\d{1})|(\d*[1-9]\d*\.\d{2}))$/;
			,'请输入正确的数字'
	  	]
	});

	//日期选择器
  	laydate.render({
    	elem: '#willOccurDate'
    	,trigger: 'click'
  	});

  	//项目名称select监听
    form.on('select(add_select_proId)', function(data){
    	var id = data.value;
    	if(id == null || id == ''){
    		return;
    	}
    	//获取公司下的所有部门
		$.ajax({
			type : "POST", //提交方式
			url : "${ctx}/setupPro/getSetupProById",//路径
			data : {
				"id" :id
			},//数据，这里使用的是Json格式进行传输
			success : function(result) {//返回数据根据结果进行相应的处理
				if(result.flag==true){
					form.val('add_info_from',result.setupPro); // 填充原值
					var setupPro = result.setupPro;
					if(setupPro.isInStore == '0'){
			    		$("#isInStore").val('未入库');
					}else{
			    		$("#isInStore").val('已入库');
					}
					if(setupPro.fromChannel == '2'){
			    		$("#linkPowerDiv").show();
			    		$("#fromChannelName").val('居间合作');
					}else{
			    		$("#linkPowerDiv").hide();
			    		$("#fromChannelName").val('自行获取');
					}
					if(setupPro.setupProCoopVos.length > 0){
						$('#coopDiv').html('');
						layui.$.each(setupPro.setupProCoopVos, function(ind,item){
							var i = ind + 1;
							var strBuffer = "";
							strBuffer += '<div class="layui-form-item" id="linkRow'+i+'">';
							strBuffer += '	<div class="layui-inline width106">';
							strBuffer += '		<p class="right">单位<label>'+i+'</label>：</p>';
							strBuffer += '	</div>';
							strBuffer += '	<div class="layui-inline">';
							strBuffer += '		<label class="layui-form-label width60">单位名称</label>';
							strBuffer += '		<div class="layui-input-inline">';
							strBuffer += '			<input type="hidden" name="sgCoopId" value="'+item.sgCoopId+'">';
							strBuffer += '			<input type="text" name="sgCoopName" value="'+item.coopName+'" readonly="readonly" style="border:0px;width:220px" class="layui-input">';
							strBuffer += '		</div>';
							strBuffer += '	</div>';
							strBuffer += '	<div class="layui-inline">';
					   		strBuffer += '		<label class="layui-form-label">单位作用</label>';
					   		strBuffer += '		<div class="layui-input-inline">';
							strBuffer += '			<input type="hidden" name="coopEffect" value="'+item.coopEffect+'">';
							strBuffer += '			<input type="text" name="coopEffectName" value="'+item.coopEffectName+'" readonly="readonly" style="border:0px" class="layui-input">';
					   		strBuffer += '		</div>';
					   		strBuffer += '	</div>';
							strBuffer += '</div>';
							$('#coopDiv').append(strBuffer);
				        });
						form.render();
					}
					//项目子项页面拼接
					if(setupPro.setupProSubs.length > 0){
						$('#subDiv').html('');
						layui.$.each(setupPro.setupProSubs, function(i,item){
							var ind = i + 1;
							var medalHtml = '';
							medalHtml += '<div id="commRow'+ind+'">';
							medalHtml += '	<div class="layui-form-item">';
							medalHtml += '	<div class="layui-inline width106">';
							medalHtml += '		<p class="right">子项<label>'+ind+'</label>：</p>';
							medalHtml += '		<input type="hidden" name="orderIdx" value="'+ind+'"/>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width60">子项名称</label>';
							medalHtml += '		<div class="layui-input-inline">';
							medalHtml += '			<input type="text" name="subName" value="'+item.subName+'" readonly="readonly" style="border:0px" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">合作周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subWorkYears" value="'+item.workYears+'" readonly="readonly" style="border:0px" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">建设周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subBuildYears" value="'+item.buildYears+'" readonly="readonly" style="border:0px" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	<div class="layui-inline">';
							medalHtml += '		<label class="layui-form-label width98">运营周期（年）</label>';
							medalHtml += '		<div class="layui-input-inline" style="width:98px;">';
							medalHtml += '			<input type="text" name="subOmYears" value="'+item.omYears+'" readonly="readonly" style="border:0px" class="layui-input">';
							medalHtml += '		</div>';
							medalHtml += '	</div>';
							medalHtml += '	</div>';
							medalHtml += '</div>';
							$('#subDiv').append(medalHtml);
						});
						form.render();
					}

					//获取回报机制复选框
					var backCheckbox = $("input[name=backMechName]");
					backCheckbox.each(function(){
						if(setupPro.backMech.indexOf($(this).val()) != -1){
			            	$(this).prop('checked', true);
						}else{
			            	$(this).prop('checked', false);
						}
			         	form.render();
			         })
				}else{
					layer.msg('数据通信异常~',{icon: 0});
				}
			}
		});
	});

   	//监听提交
  	form.on('submit(addInfo_form_submit)', function(data){
		var btnId=data.elem.id
		$("#"+btnId).removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
		if(btnId=='addInfo_form_submit'){
			$("#submitType").val('2');
		}else{
			$("#submitType").val('1');
		}
		var url='/proSell/save';
		if(data.field.id&&data.field.id!=''){
			url='/proSell/edit';
		}  		layer.load();
       	//提交 Ajax 成功后，静态更新表格中的数据
       	$.ajax({
           	type : 'post',
			url : basePath + url,
           	data: $('#addInfo_form').serialize(),
			success:function(result){
				if(result.success){
					layer.closeAll('loading'); //关闭loading
					layer.msg('提交单据成功~',{icon: 1});
					//两秒后关闭当前页面
					setTimeout(function(){
						/**
						 * 查找父菜单，并刷新
						 */
						var topDoc = $(window.top.document);
						var path = basePath + '/proSell/list';
						// 获取页面名称
						var name = topDoc.find(".layui-nav-item [lay-href^='" + path + "']").text();
						if(name == '' || name == null){
							name = '营销策划';
						}
						window.parent.layui.index.openTabsPage(path, name);
						var iframe = window.parent.layui.admin.tabsBody(window.parent.layui.admin.tabsPage.index).find(".layadmin-iframe");
						iframe[0].contentWindow.location.reload(true);

						/**
						 * 关闭当前页
						 */
						if(data.field.id&&data.field.id!=''){
							currPath = basePath + '/proSell/toDetail?id='+data.field.id;
						}else{
							currPath = basePath + '/proSell/add';
						}
						var layid = topDoc.find("li[lay-id^='" + currPath + "']").attr('lay-id');
						window.parent.layui.element.tabDelete('layadmin-layout-tabs', layid);//关闭当前页
				        }, 2000);
				}else{
					layer.closeAll('loading'); //关闭loading
  					$("#addInfo_form_submit").removeClass("layui-btn-disabled").addClass("layui-bg-blue").attr("lay-submit","");
					layer.msg(result.msg,{icon: 7});
			  	}
			}
       	});
   	});
 	// data-type事件
    $('.layui-btn.layuiadmin-btn-admin').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });

  });

	//新增联合体单位
	function addRow(t){
		var $ = layui.$;
		var laydate = layui.laydate;
		var thisid = $(t).attr("id").substring(10);
		thisid = $("div[id=linkRow" + thisid + "]").find("div:first").find("label").html();
		thisid = parseInt(thisid);
		var nextIndex = parseInt(thisid) + 1;
		var maxInd = $("div[id^='linkRow']").length;
		$("div[id^='linkRow']").each(function(){
			var tId = $(this).attr("id").substring(7);
			tId = parseInt(tId);
		  	if(tId > maxInd){
		  		maxInd = parseInt(tId);
		  	}
		  	var thisIndex = $(this).find("div:first").find("label").html();
		  	thisIndex = parseInt(thisIndex);
		  	var nextId = thisIndex + 1;
		  	if(thisIndex > thisid) {
		  		$("div[id=linkRow" + tId + "]").find("div:first").find("label").html(nextId);
		  		$("div[id=linkRow" + tId + "]").find("div:first").find("input").val(nextId);
		  	}
		});
		var ind = maxInd + 1;
		var sgCoopDiv = $("#sgCoopSelect").clone();
		var medalHtml = '';
		medalHtml += '<div class="layui-form-item" id="linkRow'+ind+'">';
		medalHtml += '	<div class="layui-inline width106">';
		medalHtml += '		<p class="right">营销费用<label>'+nextIndex+'</label>：</p>';
		medalHtml += '		<input type="hidden" name="costOrderIdx" value="'+nextIndex+'"/>';
		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<label class="layui-form-label width60">费用类型</label>';
		medalHtml += '		<div class="layui-input-inline" style="width:130px;">';
   		medalHtml += sgCoopDiv.html();
   		medalHtml += '		</div>';
   		medalHtml += '	</div>';
   		medalHtml += '	<div class="layui-inline">';
   		medalHtml += '		<label class="layui-form-label width98">预计发生日期</label>';
   		medalHtml += '		<div class="layui-input-inline" style="width:100px;">';
   		medalHtml += '			<input type="text" class="layui-input sub-date" name="willOccurDate" lay-verify="required" >';
   		medalHtml += '		</div>';
   		medalHtml += '	</div>';
   		medalHtml += '	<div class="layui-inline">';
   		medalHtml += '		<label class="layui-form-label width98">费用金额（元）</label>';
   		medalHtml += '		<div class="layui-input-inline" style="width:100px;">';
   		medalHtml += '			<input type="text" class="layui-input" maxlength="13" name="costMoney" onblur="isNumberFloat(this);arabiaToCN(this,1);" lay-verify="required|floatAmount">';
   		medalHtml += '		</div>';
   		medalHtml += '	</div>';
		medalHtml += '	<div class="layui-inline">';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="addLinkBtn'+ind+'" onclick="addRow(this);"><i class="layui-icon">&#xe654;</i></button>';
		medalHtml += '		<button type="button" class="layui-btn layui-btn-sm" id="delLinkBtn'+ind+'" onclick="deleteRow('+ind+');"><i class="layui-icon">&#xe640;</i></button>';
		medalHtml += '	</div>';
		medalHtml += '</div>';

		$(t).parent().parent().after(medalHtml);
		layui.form.render();

		 var laydate = layui.laydate;
         lay('.sub-date').each(function () {
             laydate.render({
                 elem: this,
                 trigger: 'click',
                 format: 'yyyy-MM-dd'
             });
         });
	}

	//删除一行
	function deleteRow(id){
		var $ = layui.$;
		layui.layer.confirm('确定删除？',{icon:3, title :'提示'}, function(index){
 		   	var thisid = $("div[id=linkRow" + id + "]").find("div:first").find("label").html();
	    	thisid = parseInt(thisid);
	    	$("div[id^='linkRow']").each(function(){
				var tId = $(this).attr("id").substring(7);
				tId = parseInt(tId);
			  	var thisIndex = $("div[id=linkRow" + tId + "]").find("div:first").find("label").html();
			  	thisIndex = parseInt(thisIndex);
			  	var nextId = thisIndex - 1;
			  	if(thisIndex > thisid) {
			  		$("div[id=linkRow" + tId + "]").find("div:first").find("label").html(nextId);
			  		$("div[id=linkRow" + tId + "]").find("div:first").find("input").val(nextId);
			  	}
			});
	    	$("#linkRow"+id).remove();
			calcSumAmount();
			layui.layer.close(index);
 		});
	}

	//'请输入正确数字，且保留两位小数！'
	function isNumberFloat(str) {
		var $ = layui.$, form = layui.form
		if (str.value == '' || str.value == null) {
			return;
		}
		var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;

		var boolrgx = rgx.test(str.value);// true
		if (!boolrgx) {
			str.value =0;
			layer.msg('请输入正确数字，且保留两位小数！');
		}
		calcSumAmount();
	}

	//计算总投资额、建安工程总费用
	function calcSumAmount(){
		var $ = layui.$;
		var totalCostMoney = 0;
		$("input[name=costMoney]").each(function(){
			if($(this).val() != ''){
				totalCostMoney = totalCostMoney + parseFloat($(this).val());
			}
		});
		$("#costMoneyTotal").val(totalCostMoney.toFixed(2));
	}
  </script>
</body>
</html>

